/**   
 * 项目名：phms3
 * 日期：    2019-11-23 10:35:54  
 * Copyright (c) 2015- HTSC-版权所有     
 */

package com.joysuch.wwyt.mh.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_mh_alarm_message")
@SQLDelete(sql = "update wwyt_mh_alarm_message set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_mh_alarm_message set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")

public class MhAlarmMessage implements java.io.Serializable {

    // columns START
    // ID
    private Long id;
    // 租户
    private Long tenentId;
    // 组织机构代码
    private String orgCode;
    // 报警级别
    private Integer level;
    // 报警时间
    private java.time.LocalDateTime alarmTime;
    // 报警详情
    private String detail;
    //
    private String alarmPosition;
    //
    private String alarmArea;
    //
    private String alarmDept;
    //
    private String deptCharger;
    //
    private Byte majorHazardFlag;
    //
    private String majorHazardName;
    //
    private Integer majorHazardLevel;
    // 状态 0：报警中 1：已经恢复正常范围 2：已处理
    private Integer state;
    //
    private String handleBy;
    //
    private java.time.LocalDateTime handleTime;
    // 创建人
    private Long createBy;
    // 创建时间
    private java.time.LocalDateTime createTime;
    // 更新人
    private Long updateBy;
    // 更新时间
    private java.time.LocalDateTime updateTime;
    // 删除标记
    private String deleteFlag;
    // columns END
    // 备注
    private String remark;
    // 数值，带单位
    private String value;
    // 报警原因
    private String alarmReason;
    // 编号
    private String code;
    //报警级别名称:蓝-黄-橙-红
    private String levelName;
    //推送时间
    private java.time.LocalDateTime pushTime;

    @Column(name = "REMARK", length = 255)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Column(name = "ALARM_REASON", length = 500)
    public String getAlarmReason() {
        return alarmReason;
    }

    public void setAlarmReason(String alarmReason) {
        this.alarmReason = alarmReason;
    }

    @Column(name = "CODE", length = 18)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Column(name = "VALUE", length = 30)
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(Long value) {
        this.tenentId = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    @Column(name = "LEVEL")
    public Integer getLevel() {
        return this.level;
    }

    public void setLevel(Integer value) {
        this.level = value;
    }

    @Column(name = "ALARM_TIME")
    public java.time.LocalDateTime getAlarmTime() {
        return this.alarmTime;
    }

    public void setAlarmTime(java.time.LocalDateTime value) {
        this.alarmTime = value;
    }

    @Column(name = "DETAIL", length = 65535)
    public String getDetail() {
        return this.detail;
    }

    public void setDetail(String value) {
        this.detail = value;
    }

    @Column(name = "ALARM_POSITION", length = 128)
    public String getAlarmPosition() {
        return this.alarmPosition;
    }

    public void setAlarmPosition(String value) {
        this.alarmPosition = value;
    }

    @Column(name = "ALARM_AREA", length = 128)
    public String getAlarmArea() {
        return this.alarmArea;
    }

    public void setAlarmArea(String value) {
        this.alarmArea = value;
    }

    @Column(name = "ALARM_DEPT", length = 64)
    public String getAlarmDept() {
        return this.alarmDept;
    }

    public void setAlarmDept(String value) {
        this.alarmDept = value;
    }

    @Column(name = "DEPT_CHARGER", length = 64)
    public String getDeptCharger() {
        return this.deptCharger;
    }

    public void setDeptCharger(String value) {
        this.deptCharger = value;
    }

    @Column(name = "MAJOR_HAZARD_FLAG")
    public Byte getMajorHazardFlag() {
        return this.majorHazardFlag;
    }

    public void setMajorHazardFlag(Byte value) {
        this.majorHazardFlag = value;
    }

    @Column(name = "MAJOR_HAZARD_NAME", length = 64)
    public String getMajorHazardName() {
        return this.majorHazardName;
    }

    public void setMajorHazardName(String value) {
        this.majorHazardName = value;
    }

    @Column(name = "MAJOR_HAZARD_LEVEL")
    public Integer getMajorHazardLevel() {
        return this.majorHazardLevel;
    }

    public void setMajorHazardLevel(Integer value) {
        this.majorHazardLevel = value;
    }

    @Column(name = "STATE")
    public Integer getState() {
        return this.state;
    }

    public void setState(Integer value) {
        this.state = value;
    }

    @Column(name = "HANDLE_BY", length = 64)
    public String getHandleBy() {
        return this.handleBy;
    }

    public void setHandleBy(String value) {
        this.handleBy = value;
    }

    @Column(name = "HANDLE_TIME")
    public java.time.LocalDateTime getHandleTime() {
        return this.handleTime;
    }

    public void setHandleTime(java.time.LocalDateTime value) {
        this.handleTime = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public java.time.LocalDateTime getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(java.time.LocalDateTime value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public java.time.LocalDateTime getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(java.time.LocalDateTime value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }
    @Column(name = "level_name")
    public String getLevelName() {
        return this.levelName;
    }

    public void setLevelName(String value) {
        this.levelName = value;
    }

    private MhMonitoringPoint mhMonitoringPoint;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "MONITORING_POINT_ID")
    public MhMonitoringPoint getMhMonitoringPoint() {
        return this.mhMonitoringPoint;
    }

    public void setMhMonitoringPoint(MhMonitoringPoint mhMonitoringPoint) {
        this.mhMonitoringPoint = mhMonitoringPoint;
    }

    private MhMonitoringType mhMonitoringType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "MONITORING_TYPE_ID")
    public MhMonitoringType getMhMonitoringType() {
        return this.mhMonitoringType;
    }

    public void setMhMonitoringType(MhMonitoringType mhMonitoringType) {
        this.mhMonitoringType = mhMonitoringType;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "push_time")
    public java.time.LocalDateTime getPushTime() {
        return this.pushTime;
    }

    public void setPushTime(java.time.LocalDateTime value) {
        this.pushTime = value;
    }
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("tenentId", getTenentId()).append("orgCode", getOrgCode()).append("level", getLevel())
                .append("alarmTime", getAlarmTime()).append("detail", getDetail())
                .append("alarmPosition", getAlarmPosition()).append("alarmArea", getAlarmArea())
                .append("alarmDept", getAlarmDept()).append("deptCharger", getDeptCharger())
                .append("majorHazardFlag", getMajorHazardFlag()).append("majorHazardName", getMajorHazardName())
                .append("majorHazardLevel", getMajorHazardLevel()).append("state", getState())
                .append("handleBy", getHandleBy()).append("handleTime", getHandleTime())
                .append("createBy", getCreateBy()).append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("pushTime", getPushTime())
                .append("deleteFlag", getDeleteFlag()).append("levelName", getLevelName()).toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof MhAlarmMessage == false)
            return false;
        if (this == obj)
            return true;
        MhAlarmMessage other = (MhAlarmMessage) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
